package com.demo.test;

public class 移位与或运算 {

	public static void main(String[] args) {
		int i = 3; // 00001011
		System.out.println(Integer.toBinaryString(i));
		System.out.println(i << 2);
		System.out.println(i >> 2);
		System.out.println(i >>> 2);

		i = -3; // -1011
		System.out.println(Integer.toBinaryString(i));
		System.out.println(i << 2);
		System.out.println(i >> 2);
		System.out.println(i >>> 2);

		System.out.println(5 & 3);
		System.out.println(5 | 3);
		System.out.println(5 ^ 3);
		System.out.println(~3);
	}
}
